package com.hedl.practice.diyJava.reflex.study_01.tmp02;

import java.util.Random;

public class District extends Student{
    public District(){}
    public District(String name){
        super(name);
    }

    public void write(String title){
        setTitle(title);

        //给作文打个分
        int[] scores = {5,10,15,20};
        Random random = new Random();
        //区长儿子 领导意思是加5分
        int realScore = scores[random.nextInt(3) + 0];
        if (realScore <= 15){ // 满分20
            System.out.println(getName()+"是区长儿子，领导让加5分");
            realScore += 5;
        }
        setScore(realScore);
    }

    public void eat(){
        //区长儿子，喜欢吃鸡腿
        String menu = getFoods().toString();
        menu = menu + "，鸡腿";
        System.out.println("今天" + getFoods().day + ",我吃了" + menu);
    }

    public String toString(){
        return "写了一篇作文《" + getTitle() + "》,得分" + getScore();
    }
}
